package cn.hy.dataSync.job.scheduler;


import cn.hy.dataSync.statistics.container.communicator.AbstractContainerCommunicator;

/**
 * 调度器
 */
public class JobScheduler extends ProcessScheduler {

    private volatile boolean killing = false;

    public JobScheduler(AbstractContainerCommunicator containerCommunicator) {
        super(containerCommunicator);

        // 在job 本身，即当程序结束的时候
        Runtime.getRuntime().addShutdownHook(new Thread(() -> this.killing = true));
    }

    @Override
    protected boolean isJobKilling(String jobId) {
        return this.killing;
    }
}
